import myRequest from '../utils/myRequest'
const ticket_path = 'posts'
function getTicketsByUserId(userid) {
  console.debug('in gettickets')
  let url = ticket_path+'?userid='+userid
  return myRequest.getRequest(url)
}
function getTicket(id) {
  console.log('in getticket')
  let url = ticket_path+'/'+id
  return myRequest.getRequest(url)
}
function addTicket(ticket) {
  console.debug('in addticket')
  console.log(ticket)
  let url = ticket_path
  return myRequest.postRequest(url, ticket)
}
function replyTicket(ticket) {
  console.debug('in replyTicket')
  console.debug(ticket)
  let url = ticket_path+'/'+ticket.id+'/reply'
  return myRequest.putRequest(url, ticket)
}
export default {
  addTicket: addTicket,
  getTicket: getTicket,
  replyTicket: replyTicket,
  getTicketsByUserId: getTicketsByUserId
}